package com.dick.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dick.base.dto.OrderNotProduced;
import com.dick.base.model.BusinessOrderItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public interface BusinessOrderItemMapper extends BaseMapper<BusinessOrderItem> {

    @Select("SELECT order_id, COUNT(1) AS quantity FROM business_order_item WHERE status < 30 AND order_id IN #{ids} GROUP BY order_id")
    List<OrderNotProduced> findOrderNotProduced(@Param("ids") Set<Long> ids);
}
